<?php

class myCredentials extends sfFilter
{
  public function execute ($filterChain)
  {
      $request = $this->getContext()->getRequest();
      $response = $this->getContext()->getResponse();

      if($request->getParameter('ucenik_id') or $request->getParameter('ucenik_idp'))
      {
         if(!($ucenik_id = $request->getParameter('ucenik_idp')))
           $ucenik_id = $request->getParameter('ucenik_id');
         $user = $this->getContext()->getUser();

         $rod = DbFinder::from('Ucenik')->select('RoditeljId')->findPk($ucenik_id);
         if($user->getAttribute('id') != $rod)
           die('Greška, kredencijali!!!');
      }

      $filterChain->execute();
  }
}